package com.news.utils;

import java.sql.Date;
import java.text.SimpleDateFormat;

/**
 * @Author:weiming
 * @Date:2021/4/19
 */
public class DateUtils {

    public static String sqlDateToString(Date date){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        long time = date.getTime();
        Date date1 = new Date(time);
        return simpleDateFormat.format(date1);
    }

    public static Date toSqlDate(java.util.Date date){
        long time = date.getTime();
        return new Date(time);
    }

    public static Date toUtilDate(Date date){
        long time = date.getTime();
        return  new Date(time);
    }

}
